<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="com.serviceprovider.business.utility.SecurityContextUser"%>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<%@include file="/WEB-INF/taglibs/common/taglibs.jsp" %>
<head>
<title><spring:message code="sp.customfeesreport.title" /></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link  rel="stylesheet" href="<c:url value="/css/styles.css"/>"/>
<link  rel="stylesheet" href="<c:url value="/javascripts/jscalendar/theme/calendar-system.css"/>"/>
<script src="<c:url value="/javascripts/jscalendar/calendar-cfg.js"/>" ></script>
<script src="<c:url value="/javascripts/calendar.js"/>" ></script>
<script src="<c:url value="/javascripts/jscalendar/lang/calendar-en.js"/>" ></script>
<script src="<c:url value="/javascripts/jscalendar/calendar-setup.js"/>" ></script>

<script src="<c:url value="/javascripts/common.js"/>">
</script>
</head>
<body><div class="page">
<%
    Object isAdmin = SecurityContextUser.isAdmin();
    if(Boolean.TRUE.equals(isAdmin)){
        %>
            <%@include file="../../admin/top_menu.jsp"%>
        <%
    } else{
        %>
            <%@include file="../top_menu.jsp"%>
        <%
    }
    %>
<table width=100%>
	<tr>
		<td><%@include file="/WEB-INF/jsp/include/messages.jsp"%>
		<br />
		</td>
	</tr>

</table>
<div class="contentArea">
 
	<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td><h4><spring:message code="sp.customfeesreport.label.customreports" /></h4></td>
			</tr>
			<tr><td></td></tr>
			<tr>
				<td><spring:message code="sp.customfeesreport.label.thispageallowsyoutosavetext" />.</td>
			</tr>
			<tr><td></td></tr>
	</table>

<form:form commandName="criteria" method="post">
        <table border="0" cellpadding="2" cellspacing="0">
            <tr>
				<td></td>
            </tr>
            <tr>            	
                <td><spring:message code="sp.customfeesreport.label.yourreporttitle" /></td>
				<td colspan="3"><form:input path="name" size="40" /></td>
            </tr>            
            <%
            if(Boolean.TRUE.equals(isAdmin)){
                %>
                <tr>
                    <td><spring:message code="sp.customfeesreport.label.providers" />:</td>
                    <td colspan="3">
                        <form:select path="userId" cssStyle="width:50%">
                            <c:forEach items="${providers}" var="provider" varStatus="i">
                                <form:option value="${provider.id}">${provider.firstName}&nbsp;${provider.lastName}</form:option>
                             </c:forEach>
                        </form:select>
                    </td>
                </tr>   
                <%
            }
            %>
            <tr>
                <td><spring:message code="sp.customfeesreport.label.datefrom" />:</td>
                <td><component:calendar bindPath="dateFrom"/></td>

                <td><spring:message code="sp.customfeesreport.label.dateto" />:</td>
                <td><component:calendar bindPath="dateTo"/></td>
            </tr>
            <tr>
                <td><spring:message code="sp.customfeesreport.label.payees" />:</td>
                <td colspan="3">
                    <form:select path="payeesId" multiple="true" cssStyle="width:50%">
                        <c:forEach items="${payees}" var="payee" varStatus="i">
                            <form:option value="${payee.id}">${payee.firstName}&nbsp;${payee.lastName}</form:option>
                         </c:forEach>
                    </form:select>
                </td>
            </tr>
            <tr>
                <td><spring:message code="sp.customfeesreport.label.transactionstatus" />:</td>
                <td><form:select path="transactionStatus">
                        <form:option value="-1">All</form:option>
						<c:forEach items="${statuses}" var="item" varStatus="i">
						    <form:option value="${item.id}">${item.name}</form:option>
						 </c:forEach>
					</form:select>
                </td>
                <td><spring:message code="sp.customfeesreport.label.selectreport" />:</td>
                <td>
                	<form:select path="reportType">
						<c:forEach items="${reportTypes}" var="item" varStatus="i">
						    <form:option value="${item}">${item}</form:option>
						 </c:forEach>                	
                	</form:select>
                </td>
                
            </tr>
			<tr>
				<td align="right" colspan="4">
					<spring:message code="sp.customfeesreport.label.filtercolumns" />:
                    <c:forEach items="${selectedFee}" var="fee">
                        <form:checkbox path="selectedFees" value="${fee}"/>&nbsp;<fmt:message key="TransactionDetail.${fee}" />
                    </c:forEach>
				</td>
			</tr>            
            <tr>
                <td></td><td><input type="submit" class='ui-button ui-state-default ui-corner-all' value="Save"/></td>
            </tr>
        </table>
    </form:form>
    
    <table border=0 cellpadding=4 cellspacing=1 width=100%>
        <thead>
            <tr><th colspan="4"><h3><spring:message code="sp.customfeesreport.label.youravailablecustomreports" /></h3></th></tr>
            <tr>
            	<th><spring:message code="sp.customfeesreport.label.no" /></th>
            	<th><spring:message code="sp.customfeesreport.label.name" /></th>
            	<th><spring:message code="sp.customfeesreport.label.from" /></th>
            	<th><spring:message code="sp.customfeesreport.label.to" /></th>
            	<th><spring:message code="sp.customfeesreport.label.transactionstatus" /></th>
            	<th><spring:message code="sp.customfeesreport.label.reporttype" /></th>
            	<th><spring:message code="sp.customfeesreport.label.actions" /></th>
            </tr>
            
            <c:forEach items="${listReports}" var="item" varStatus="i">
            <tr>
            	<td>${i.index + 1}</td>
            	<td><a href="run_custom_report.htm?id=${item.id}">${item.name}</a></td>
            	<td>${item.dateFrom}</td>
            	<td>${item.dateTo}</td>
            	<td><fmt:message key="OrderStatus.status${item.transactionStatus}" /></td>
            	<td>${item.reportType}</td>
            	<td><a href="delete_custom_report.htm?id=${item.id}">Delete</a></td>
            </tr>
            </c:forEach>
            
        </thead>
       <tbody>
       </tbody>
    </table>
</div></div><%@include file="/WEB-INF/jsp/include/footer.jsp"%>
</body>
</html>